<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Archive::Zip::SimpleZip - Create Zip Archives - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Archive-Zip-SimpleZip - MetaCPAN" href="https://metacpan.org/dist/Archive-Zip-SimpleZip/releases.rss" />
        <link rel="canonical" href="./Archive::Zip::SimpleZip.html" />
        <meta name="description" content="Create Zip Archives" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Archive::Zip::SimpleZip" />
<meta name="twitter:title"       content="Archive::Zip::SimpleZip" />
<meta name="twitter:description" content="Create Zip Archives" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Archive::Zip::SimpleZip.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Archive-Zip-SimpleZip was released.">
      <span class="relatize">25 Jun 2022 14:12:33 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Archive-Zip-SimpleZip">Archive-Zip-SimpleZip</a>
  </li>
  <li>
    Module version: 1.000
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Archive-Zip-SimpleZip/source/lib/Archive/Zip/SimpleZip.pm">Source</a>
    (<a href="https://metacpan.org/dist/Archive-Zip-SimpleZip/source/lib/Archive/Zip/SimpleZip.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Archive-Zip-SimpleZip/source/lib/Archive/Zip">Browse</a>
    (<a href="https://metacpan.org/dist/Archive-Zip-SimpleZip/source/lib/Archive/Zip?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Archive-Zip-SimpleZip/changes">Changes</a>
    </li>
    <li>
      <a rel="noopener nofollow" class="nopopup" href="https://github.com/pmqs/Archive-Zip-SimpleZip">Homepage</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Archive-Zip-SimpleZip/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/pmqs/Archive-Zip-SimpleZip">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://github.com/pmqs/Archive-Zip-SimpleZip/issues">Issues</a>
      (1)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Archive-Zip-SimpleZip+1.000" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/A/Archive-Zip-SimpleZip.html?oncpan=1&amp;distmat=1&amp;version=1.000&amp;grade=2" style="color: #090">74</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/A/Archive-Zip-SimpleZip.html?oncpan=1&amp;distmat=1&amp;version=1.000&amp;grade=3" style="color: #900">0</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/A/Archive-Zip-SimpleZip.html?oncpan=1&amp;distmat=1&amp;version=1.000&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/PMQS/Archive-Zip-SimpleZip-1.000">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Archive-Zip-SimpleZip who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 1
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Archive-Zip-SimpleZip-1.000/index.html">77.67% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Archive-Zip-SimpleZip/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/P/PM/PMQS/Archive-Zip-SimpleZip-1.000.tar.gz">
      Download (<span itemprop="fileSize">73.31KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FPMQS%2FArchive-Zip-SimpleZip-1.000%2Flib%2FArchive%2FZip%2FSimpleZip.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Archive-Zip-SimpleZip/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Archive-Zip-SimpleZip/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Archive-Zip-SimpleZip">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Archive-Zip-SimpleZip">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Archive/Zip/SimpleZip.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="PMQS/Archive-Zip-SimpleZip-1.000"
>1.000
  (PMQS on 2022-06-25)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.040"
>0.040
  (PMQS on 2021-07-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.039"
>0.039
  (PMQS on 2020-09-09)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.038"
>0.038
  (PMQS on 2020-09-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.037"
>0.037
  (PMQS on 2020-09-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.036"
>0.036
  (PMQS on 2020-08-03)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.035"
>0.035
  (PMQS on 2019-12-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.034"
>0.034
  (PMQS on 2019-12-05)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.033"
>0.033
  (PMQS on 2019-12-04)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.032"
>0.032
  (PMQS on 2019-11-24)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.031"
>0.031
  (PMQS on 2019-11-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.030"
>0.030
  (PMQS on 2019-11-09)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.029"
>0.029
  (PMQS on 2019-11-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.028"
>0.028
  (PMQS on 2019-11-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.027"
>0.027
  (PMQS on 2019-11-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.026"
>0.026
  (PMQS on 2019-11-05)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.025"
>0.025
  (PMQS on 2019-06-20)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.024"
>0.024
  (PMQS on 2019-06-16)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.022"
>0.022
  (PMQS on 2018-04-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.021"
>0.021
  (PMQS on 2018-04-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.020"
>0.020
  (PMQS on 2018-04-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.010"
>0.010
  (PMQS on 2017-04-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.009"
>0.009
  (PMQS on 2013-02-17)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.008"
>0.008
  (PMQS on 2013-01-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.007"
>0.007
  (PMQS on 2012-12-17)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.006"
>0.006
  (PMQS on 2012-12-15)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.005"
>0.005
  (PMQS on 2012-11-11)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.004"
>0.004
  (PMQS on 2012-08-18)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.003"
>0.003
  (PMQS on 2012-05-01)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.002"
>0.002
  (PMQS on 2012-04-29)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.001"
>0.001
  (PMQS on 2012-04-29)</option>
<optgroup label="BackPAN">'
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.023"
>0.023
  (PMQS on 2019-06-16)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/PMQS/Archive-Zip-SimpleZip-1.000/diff/' + encodeURIComponent(this.value) + '/lib/Archive/Zip/SimpleZip.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="PMQS/Archive-Zip-SimpleZip-1.000"
>1.000
  (PMQS on 2022-06-25)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.040"
>0.040
  (PMQS on 2021-07-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.039"
>0.039
  (PMQS on 2020-09-09)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.038"
>0.038
  (PMQS on 2020-09-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.037"
>0.037
  (PMQS on 2020-09-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.036"
>0.036
  (PMQS on 2020-08-03)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.035"
>0.035
  (PMQS on 2019-12-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.034"
>0.034
  (PMQS on 2019-12-05)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.033"
>0.033
  (PMQS on 2019-12-04)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.032"
>0.032
  (PMQS on 2019-11-24)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.031"
>0.031
  (PMQS on 2019-11-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.030"
>0.030
  (PMQS on 2019-11-09)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.029"
>0.029
  (PMQS on 2019-11-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.028"
>0.028
  (PMQS on 2019-11-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.027"
>0.027
  (PMQS on 2019-11-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.026"
>0.026
  (PMQS on 2019-11-05)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.025"
>0.025
  (PMQS on 2019-06-20)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.024"
>0.024
  (PMQS on 2019-06-16)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.022"
>0.022
  (PMQS on 2018-04-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.021"
>0.021
  (PMQS on 2018-04-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.020"
>0.020
  (PMQS on 2018-04-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.010"
>0.010
  (PMQS on 2017-04-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.009"
>0.009
  (PMQS on 2013-02-17)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.008"
>0.008
  (PMQS on 2013-01-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.007"
>0.007
  (PMQS on 2012-12-17)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.006"
>0.006
  (PMQS on 2012-12-15)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.005"
>0.005
  (PMQS on 2012-11-11)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.004"
>0.004
  (PMQS on 2012-08-18)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.003"
>0.003
  (PMQS on 2012-05-01)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.002"
>0.002
  (PMQS on 2012-04-29)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.001"
>0.001
  (PMQS on 2012-04-29)</option>
<optgroup label="BackPAN">'
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.023"
>0.023
  (PMQS on 2019-06-16)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/IO::Compress::Base" title="IO::Compress::Base" class="ellipsis">IO::Compress::Base</a></li>
  <li><a href="https://metacpan.org/pod/IO::Compress::Bzip2" title="IO::Compress::Bzip2" class="ellipsis">IO::Compress::Bzip2</a></li>
  <li><a href="https://metacpan.org/pod/IO::Compress::RawDeflate" title="IO::Compress::RawDeflate" class="ellipsis">IO::Compress::RawDeflate</a></li>
  <li><a href="https://metacpan.org/pod/IO::Compress::Zip" title="IO::Compress::Zip" class="ellipsis">IO::Compress::Zip</a></li>
  <li><a href="https://metacpan.org/pod/IO::Uncompress::Base" title="IO::Uncompress::Base" class="ellipsis">IO::Uncompress::Base</a></li>
  <li><a href="https://metacpan.org/pod/IO::Uncompress::RawInflate" title="IO::Uncompress::RawInflate" class="ellipsis">IO::Uncompress::RawInflate</a></li>
  <li><a href="https://metacpan.org/pod/IO::Uncompress::Unzip" title="IO::Uncompress::Unzip" class="ellipsis">IO::Uncompress::Unzip</a></li>
  <li><a href="https://metacpan.org/pod/Perl::OSType" title="Perl::OSType" class="ellipsis">Perl::OSType</a></li>
  <li><i class="ttip" title="dynamic_config enabled">and possibly others</i></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Archive::Zip::SimpleZip/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Archive%3A%3AZip%3A%3ASimpleZip">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Archive-Zip-SimpleZip">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/PMQS/Archive-Zip-SimpleZip-1.000/view/lib/Archive/Zip/SimpleZip.pm">This version</a>
    </li>
    <li>
      <a href="./Archive::Zip::SimpleZip.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/VEESH"><img src="https://www.gravatar.com/avatar/5ec5a5223fe6ee8e96b03dca47b670ea?d=identicon&amp;s=20" title="VEESH" alt="VEESH"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Archive-Zip-SimpleZip/plussers">1 PAUSE user</a>
</div>
</div>
    </li>
    <li>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/PMQS" class="author-name">Paul Marquess</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Archive/Zip/SimpleZip.pm&#39;" class="">
<option
  selected
  value="PMQS/Archive-Zip-SimpleZip-1.000"
>1.000
  (PMQS on 2022-06-25)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.040"
>0.040
  (PMQS on 2021-07-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.039"
>0.039
  (PMQS on 2020-09-09)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.038"
>0.038
  (PMQS on 2020-09-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.037"
>0.037
  (PMQS on 2020-09-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.036"
>0.036
  (PMQS on 2020-08-03)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.035"
>0.035
  (PMQS on 2019-12-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.034"
>0.034
  (PMQS on 2019-12-05)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.033"
>0.033
  (PMQS on 2019-12-04)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.032"
>0.032
  (PMQS on 2019-11-24)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.031"
>0.031
  (PMQS on 2019-11-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.030"
>0.030
  (PMQS on 2019-11-09)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.029"
>0.029
  (PMQS on 2019-11-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.028"
>0.028
  (PMQS on 2019-11-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.027"
>0.027
  (PMQS on 2019-11-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.026"
>0.026
  (PMQS on 2019-11-05)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.025"
>0.025
  (PMQS on 2019-06-20)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.024"
>0.024
  (PMQS on 2019-06-16)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.022"
>0.022
  (PMQS on 2018-04-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.021"
>0.021
  (PMQS on 2018-04-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.020"
>0.020
  (PMQS on 2018-04-08)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.010"
>0.010
  (PMQS on 2017-04-10)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.009"
>0.009
  (PMQS on 2013-02-17)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.008"
>0.008
  (PMQS on 2013-01-07)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.007"
>0.007
  (PMQS on 2012-12-17)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.006"
>0.006
  (PMQS on 2012-12-15)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.005"
>0.005
  (PMQS on 2012-11-11)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.004"
>0.004
  (PMQS on 2012-08-18)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.003"
>0.003
  (PMQS on 2012-05-01)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.002"
>0.002
  (PMQS on 2012-04-29)</option>
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.001"
>0.001
  (PMQS on 2012-04-29)</option>
<optgroup label="BackPAN">'
<option
  
  value="PMQS/Archive-Zip-SimpleZip-0.023"
>0.023
  (PMQS on 2019-06-16)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Archive-Zip-SimpleZip">Archive-Zip-SimpleZip-1.000</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage zero &#10;
          No dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="5"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="10"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Archive-Zip-SimpleZip-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Archive-Zip-SimpleZip-1.000">
    <input type="hidden" name="author" value="PMQS">
    <input type="hidden" name="distribution" value="Archive-Zip-SimpleZip">
    <button type="submit" class="favorite highlight"><span>1</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Archive::Zip::SimpleZip.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>1</span> ++</a>
</div>
   / <span>Archive::Zip::SimpleZip</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Archive::Zip::SimpleZip.html#NAME">NAME</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#DESCRIPTION">DESCRIPTION</a>
    <ul>
      <li><a href="./Archive::Zip::SimpleZip.html#Constructor">Constructor</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Methods">Methods</a></li>
    </ul>
  </li>
  <li><a href="./Archive::Zip::SimpleZip.html#Options">Options</a>
    <ul>
      <li><a href="./Archive::Zip::SimpleZip.html#File-Naming-Options">File Naming Options</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Overall-Zip-Archive-Structure">Overall Zip Archive Structure</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Other-Options">Other Options</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Deflate-Compression-Options">Deflate Compression Options</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Bzip2-Compression-Options">Bzip2 Compression Options</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Lzma-&amp;-XZ-Compression-Options">Lzma &amp; XZ Compression Options</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Zstd-Compression-Options">Zstd Compression Options</a></li>
    </ul>
  </li>
  <li><a href="./Archive::Zip::SimpleZip.html#Summary-of-Default-Behaviour">Summary of Default Behaviour</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#Examples">Examples</a>
    <ul>
      <li><a href="./Archive::Zip::SimpleZip.html#A-Simple-example">A Simple example</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Creating-an-in-memory-Zip-archive">Creating an in-memory Zip archive</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Rename-whilst-adding">Rename whilst adding</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Adding-a-directory-tree-to-a-Zip-archive">Adding a directory tree to a Zip archive</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Using-addFileHandle">Using addFileHandle</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Another-filehandle-example-Working-with-Net::FTP">Another filehandle example - Working with Net::FTP</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Creating-a-Zip-file-from-STDIN">Creating a Zip file from STDIN</a></li>
    </ul>
  </li>
  <li><a href="./Archive::Zip::SimpleZip.html#Importing">Importing</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#FAQ">FAQ</a>
    <ul>
      <li><a href="./Archive::Zip::SimpleZip.html#Can-SimpleZip-update-an-existing-Zip-file?">Can SimpleZip update an existing Zip file?</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Can-I-write-a-Zip-Archive-to-STDOUT?">Can I write a Zip Archive to STDOUT?</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#Can-I-write-a-Zip-Archive-directly-to-a-socket?">Can I write a Zip Archive directly to a socket?</a></li>
      <li><a href="./Archive::Zip::SimpleZip.html#What-is-a-Streamed-Zip-file?">What is a Streamed Zip file?</a></li>
    </ul>
  </li>
  <li><a href="./Archive::Zip::SimpleZip.html#SUPPORT">SUPPORT</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#MODIFICATION-HISTORY">MODIFICATION HISTORY</a></li>
  <li><a href="./Archive::Zip::SimpleZip.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Archive::Zip::SimpleZip - Create Zip Archives</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my.zip&quot;
        or die &quot;Cannot create zip file: $SimpleZipError\n&quot; ;

    $z-&gt;add(&quot;/some/file1.txt&quot;);
    $z-&gt;addString(&quot;some text&quot;, Name =&gt; &quot;myfile&quot;);
    $z-&gt;addFileHandle($FH, Name =&gt; &quot;myfile2&quot;) ;

    $fh = $z-&gt;openMember(Name =&gt; &quot;mydata1.txt&quot;);
    print $fh &quot;some data&quot; ;
    $fh-&gt;print(&quot;some more data&quot;) ;
    close $fh;

    $z-&gt;close();</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>Archive::Zip::SimpleZip is a module that allows the creation of Zip archives. For reading Zip archives, there is a companion module, called <a href="https://metacpan.org/pod/Archive::Zip::SimpleUnzip">Archive::Zip::SimpleUnzip</a>, that can read Zip archives.</p>

<p>The module allows Zip archives to be written to a named file, a filehandle or stored in-memory.</p>

<p>There are a small number methods available in Archive::Zip::SimpleZip, and quite a few options, but for the most part all you need to know is how to create a Zip archive and how to add a file to it.</p>

<p>Below is an example of how this module is used to add the two files &quot;file1.txt&quot; and &quot;file2.txt&quot; to the zip file called &quot;my1.zip&quot;.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my1.zip&quot;
        or die &quot;Cannot create zip file: $SimpleZipError\n&quot; ;

    $z-&gt;add(&quot;/some/file1.txt&quot;);
    $z-&gt;add(&quot;/some/file2.txt&quot;);

    $z-&gt;close();</code></pre>

<p>The data written to a zip archive doesn&#39;t need to come from the filesystem. You can also write string data directly to the zip archive using the <code>addString</code> method, like this</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my2.zip&quot;
        or die &quot;Cannot create zip file: $SimpleZipError\n&quot; ;

    $z-&gt;addString($myData, Name =&gt; &quot;file2.txt&quot;);

    $z-&gt;close();</code></pre>

<p>Alternatively you can use the <code>openMember</code> option to get a filehandle that allows you to write directly to the zip archive member using standard Perl file output functions, like <code>print</code>.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my3.zip&quot;
        or die &quot;Cannot create zip file: $SimpleZipError\n&quot; ;

    my $fh = $z-&gt;openMember(Name =&gt; &quot;file3.txt&quot;);

    $fh-&gt;print(&quot;some data&quot;);
    # can also use print $fh &quot;some data&quot;

    print $fh &quot;more data&quot; ;

    $fh-&gt;close() ;
    # can also use close $fh;

    $z-&gt;close();</code></pre>

<p>You can also &quot;drop&quot; a filehandle into a zip archive.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my4.zip&quot;
        or die &quot;Cannot create zip file: $SimpleZipError\n&quot; ;

    my $fh = $z-&gt;addFileHandle(FH, Name =&gt; &quot;file3.txt&quot;);

    $z-&gt;close();</code></pre>

<h2 id="Constructor">Constructor</h2>

<pre><code>     $z = new Archive::Zip::SimpleZip &quot;myzipfile.zip&quot; [, OPTIONS] ;
     $z = new Archive::Zip::SimpleZip \$buffer [, OPTIONS] ;
     $z = new Archive::Zip::SimpleZip $filehandle [, OPTIONS] ;</code></pre>

<p>The constructor takes one mandatory parameter along with zero or more optional parameters.</p>

<p>The mandatory parameter controls where the zip archive is written. This can be any of the following</p>

<ul>

<li><p>Output to a File</p>

<p>When SimpleZip is passed a string, it will write the zip archive to the filename stored in the string.</p>

</li>
<li><p>Output to a String</p>

<p>When SimpleZip is passed a string reference, like <code>\$buffer</code>, it will write the zip archive into that string.</p>

</li>
<li><p>Output to a Filehandle</p>

<p>When SimpleZip is passed a filehandle, it will write the zip archive to that filehandle.</p>

<p>Use the string &#39;-&#39; to write the zip archive to standard output (Note - this will also enable the <code>Stream</code> option).</p>

</li>
</ul>

<p>See <a href="./Archive::Zip::SimpleZip.html#Options">&quot;Options&quot;</a> for a list of the optional parameters that can be specified when calling the constructor.</p>

<h2 id="Methods">Methods</h2>

<dl>

<dt id="$z-&gt;add($filename-[,-OPTIONS])"><a id="z--add-filename---OPTIONS"></a>$z-&gt;add($filename [, OPTIONS])</dt>
<dd>

<p>The <code>add</code> method writes the contents of the filename stored in <code>$filename</code> to the zip archive.</p>

<p>The following file types are supported.</p>

<ul>

<li><p>Standard files</p>

<p>The contents of the file is written to the zip archive.</p>

</li>
<li><p>Directories</p>

<p>The directory name is stored in the zip archive.</p>

</li>
<li><p>Symbolic Links</p>

<p>By default this module will store the contents of the file that the symbolic link refers to. To store the symbolic link itself set the <code>StoreLink</code> option to 1.</p>

</li>
</ul>

<p>By default the name of the member created in the zip archive will be derived from the value of the <code>$filename</code> parameter. See <a href="./Archive::Zip::SimpleZip.html#File-Naming-Options">&quot;File Naming Options&quot;</a> for more details.</p>

<p>See <a href="./Archive::Zip::SimpleZip.html#Options">&quot;Options&quot;</a> for a full list of the options available for this method.</p>

<p>Returns 1 if the file was added, or 0. Check the $SimpleZipError for a message.</p>

</dd>
<dt id="$z-&gt;addString($string,-Name-=&gt;-&quot;whatever&quot;-[,-OPTIONS])"><a id="z--addString-string--Name----whatever----OPTIONS"></a>$z-&gt;addString($string, Name =&gt; &quot;whatever&quot; [, OPTIONS])</dt>
<dd>

<p>The <code>addString</code> method writes &lt;$string&gt; to the zip archive. The <code>Name</code> option <i>must</i> be supplied.</p>

<p>See <a href="./Archive::Zip::SimpleZip.html#Options">&quot;Options&quot;</a> for the options available for this method.</p>

<p>Returns 1 if the file was added, or 0. Check the $SimpleZipError for a message.</p>

</dd>
<dt id="$z-&gt;addFileHandle($fh,-Name-=&gt;-&quot;whatever&quot;-[,-OPTIONS])"><a id="z--addFileHandle-fh--Name----whatever----OPTIONS"></a>$z-&gt;addFileHandle($fh, Name =&gt; &quot;whatever&quot; [, OPTIONS])</dt>
<dd>

<p>The <code>addFileHandle</code> method assumes that <code>$fh</code> is a valid filehandle that is opened for reading.</p>

<p>It writes what is read from <code>$fh</code> to the zip archive until it reaches the eof. The filehandle, <code>$fh</code>, will not be closed by <code>addFileHandle</code>.</p>

<p>The <code>Name</code> option <i>must</i> be supplied.</p>

<p>See <a href="./Archive::Zip::SimpleZip.html#Options">&quot;Options&quot;</a> for the options available for this method.</p>

<p>Returns 1 if the file was added, or 0. Check the <code>$SimpleZipError</code> for a message.</p>

</dd>
<dt id="my-$fh-=-$z-&gt;openMember(Name-=&gt;-&quot;abc&quot;-[,-OPTIONS]);"><a id="my"></a><a id="my--fh----z--openMember-Name----abc----OPTIONS"></a>my $fh = $z-&gt;openMember(Name =&gt; &quot;abc&quot; [, OPTIONS]);</dt>
<dd>

<p>This option returns a filehandle (<code>$fh</code>)that allows you to write directly to a zip member. The <code>Name</code> option <i>must</i> be supplied. See <a href="./Archive::Zip::SimpleZip.html#Options">&quot;Options&quot;</a> for the options available for this method.</p>

<p>The filehandle returned works just like a standard Perl filehandle, so all the standard file output operators, like <code>print</code>, are available to write to the zip archive.</p>

<p>When you have finished writing data to the member, close the filehandle by letting it go out of scope or by explicitly using either of the two forms shown below</p>

<pre><code>    $fh-&gt;close()
    close $fh;</code></pre>

<p>Once the filehandle is closed you can then open another member with <code>openMember</code> or use the <code>add</code> or &lt;addString&gt; or <code></code>addFilehandle&gt; methods.</p>

<p>Note that while a zip member has been opened with <code>openMember</code>, you cannot use the <code>add</code> or &lt;addString&gt; methods, or open another member with <code>openMember</code>.</p>

<p>Also, if the enclosing zip object is closed whilst a filehandle is still open for a zip member, it will be closed automatically.</p>

<p>Returns a filehandle on success or <code>undef</code> on failure.</p>

</dd>
<dt id="$z-&gt;close()"><a id="z--close"></a>$z-&gt;close()</dt>
<dd>

<p>Returns 1 if the zip archive was closed successfully, or 0. Check the $SimpleZipError for a message.</p>

</dd>
</dl>

<h1 id="Options">Options</h1>

<p>The majority of options are valid in both the constructor and in the methods that accept options. Any exceptions are noted in the text below.</p>

<p>Options specified in the constructor will be used as the defaults for all subsequent method calls.</p>

<p>For example, in the constructor below, the <code>Method</code> is set to <code>ZIP_CM_STORE</code>.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my.zip&quot;,
                             Method =&gt; ZIP_CM_STORE
        or die &quot;Cannot create zip file: $SimpleZipError\n&quot; ;

    $z-&gt;add(&quot;file1&quot;);
    $z-&gt;add(&quot;file2&quot;, Method =&gt; ZIP_CM_DEFLATE);
    $z-&gt;add(&quot;file3&quot;);

    $z-&gt;close();</code></pre>

<p>The first call to <code>add</code> doesn&#39;t specify the <code>Method</code> option, so it uses the value from the constructor (<code>ZIP_CM_STORE</code>). The second call overrides the default set in the constructor to use <code>ZIP_CM_DEFLATE</code>. The third will revert to using the default, <code>ZIP_CM_STORE</code>.</p>

<h2 id="File-Naming-Options"><a id="File"></a>File Naming Options</h2>

<p>A quick bit of zip file terminology -- A zip archive consists of one or more <i>archive members</i>, where each member has an associated filename, known as the <i>archive member name</i>.</p>

<p>The options listed in this section control how the <i>archive member name</i> (or filename) is stored the zip archive.</p>

<dl>

<dt id="Name-=&gt;-$string"><a id="Name"></a><a id="Name----string"></a><code>Name =&gt; $string</code></dt>
<dd>

<p>This option is used to explicitly set the <i>archive member name</i> in the zip archive to <code>$string</code>.</p>

<p>When used with the <code>add</code> method, this option will override any filename that was passed as a parameter.</p>

<p>The <code>Name</code> option is mandatory for the <code>addString</code> method.</p>

<p>This option is not valid in the constructor.</p>

</dd>
<dt id="CanonicalName-=&gt;-0|1"><a id="CanonicalName"></a><a id="CanonicalName---0-1"></a><code>CanonicalName =&gt; 0|1</code></dt>
<dd>

<p>This option controls whether the <i>archive member name</i> is <i>normalized</i> into Unix format before being written to the zip archive.</p>

<p>It is recommended that you keep this option enabled unless you really need to create a non-standard Zip archive.</p>

<p>This is what APPNOTE.TXT has to say on what should be stored in the zip filename header field.</p>

<pre><code>    The name of the file, with optional relative path.
    The path stored should not contain a drive or
    device letter, or a leading slash.  All slashes
    should be forward slashes &#39;/&#39; as opposed to
    backwards slashes &#39;\&#39; for compatibility with Amiga
    and UNIX file systems etc.</code></pre>

<p>This option defaults to <b>true</b>.</p>

</dd>
<dt id="FilterName-=&gt;-sub-{-...-}"><a id="FilterName"></a><a id="FilterName---sub"></a><code>FilterName =&gt; sub { ... }</code></dt>
<dd>

<p>This option allow the <i>archive member name</i> to be modified before it is written to the zip archive.</p>

<p>This option takes a parameter that must be a reference to a sub. On entry to the sub the <code>$_</code> variable will contain the name to be filtered. If no filename is available <code>$_</code> will contain an empty string.</p>

<p>The value of <code>$_</code> when the sub returns will be stored in the filename header field.</p>

<p>Note that if <code>CanonicalName</code> is enabled, a normalized filename will be passed to the sub.</p>

<p>If you use <code>FilterName</code> to modify the filename, it is your responsibility to keep the filename in Unix format.</p>

<p>See <a href="./Archive::Zip::SimpleZip.html#Rename-whilst-adding">&quot;Rename whilst adding&quot;</a> for an example of how the <code>FilterName</code> option can be used.</p>

</dd>
</dl>

<p>Taking all the options described above, the <i>archive member name</i> stored in a Zip archive is constructed as follows.</p>

<p>The initial source for the <i>archive member name</i> that gets stored in the zip archive is the filename parameter supplied to the <code>add</code> method, or the value supplied with the <code>Name</code> option for the <code>addString</code> and <code>openMember</code> methods.</p>

<p>Next, if the <code>add</code> method is used, and the <code>Name</code> option is supplied that will overide the filename parameter.</p>

<p>If the <code>CanonicalName</code> option is enabled, and it is by default, the <i>archive member name</i> gets normalized into Unix format. If the filename was absolute, it will be changed into a relative filename.</p>

<p>Finally, is the <code>FilterName</code> option is enabled, the filename will get passed to the sub supplied via the <code>$_</code> variable. The value of <code>$_</code> on exit from the sub will get stored in the zip archive.</p>

<p>Here are some examples</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my.zip&quot;
        or die &quot;$SimpleZipError\n&quot; ;

    # store &quot;my/abc.txt&quot; in the zip archive
    $z-&gt;add(&quot;/my/abc.txt&quot;) ;

    # store &quot;/my/abc.txt&quot; in the zip archive
    $z-&gt;add(&quot;/my/abc.txt&quot;, CanonoicalName =&gt; 0) ;

    # store &quot;xyz&quot; in the zip archive
    $z-&gt;add(&quot;/some/file&quot;, Name =&gt; &quot;xyz&quot;) ;

    # store &quot;file3.txt&quot; in the zip archive
    $z-&gt;add(&quot;/my/file3.txt&quot;, FilterName =&gt; sub { s#.*/## } ) ;

    # no Name option, so store &quot;&quot; in the zip archive
    $z-&gt;addString(&quot;payload data&quot;) ;

    # store &quot;xyz&quot; in the zip archive
    $z-&gt;addString(&quot;payload data&quot;, Name =&gt; &quot;xyz&quot;) ;

    # store &quot;/abc/def&quot; in the zip archive
    $z-&gt;addString(&quot;payload data&quot;, Name =&gt; &quot;/abc/def&quot;, CanonoicalName =&gt; 0) ;

    $z-&gt;close();</code></pre>

<h2 id="Overall-Zip-Archive-Structure"><a id="Overall"></a>Overall Zip Archive Structure</h2>

<dl>

<dt id="Minimal-=&gt;-1|0"><a id="Minimal"></a><a id="Minimal---1-0"></a><code>Minimal =&gt; 1|0</code></dt>
<dd>

<p>If specified, this option will disable the automatic creation of all <i>extra</i> fields in the zip local and central headers (with the exception of those needed for Zip64).</p>

<p>In particular the following fields will not be created</p>

<pre><code>    &quot;UT&quot; Extended Timestamp
    &quot;ux&quot; ExtraExtra Type 3 (if running Unix)</code></pre>

<p>This option is useful in a number of scenarios.</p>

<p>Firstly, it may be needed if you require the zip files created by <code>Archive::Zip::SimpleZip</code> to be read using a legacy version of unzip or by an application that only supports a sub-set of the zip features.</p>

<p>The other main use-case when <code>Minimal</code> is handy is when the data that <code>Minimal</code> suppresses is not needed, and so just adds unnecessary bloat to the zip file. The extra fields that <code>Archive::Zip::SimpleZip</code> adds by default all store information that assume the entry in the zip file corresponds to a file that will be stored in a filesystem. This information is very useful when archiving files from a filesystem - it means the unzipped files will more closely match their originals. If the zip file isn&#39;t going to be unzipped to a filesystem you can save a few bytes by enabling &lt;Minimal&gt;.</p>

<p>This parameter defaults to 0.</p>

</dd>
<dt id="Stream-=&gt;-0|1"><a id="Stream"></a><a id="Stream---0-1"></a><code>Stream =&gt; 0|1</code></dt>
<dd>

<p>This option controls whether the zip archive is created in <i>streaming mode</i>.</p>

<p>Note that when outputting to a file or filehandle with streaming mode disabled (<code>Stream</code> is 0), the output file/handle <i>must</i> be seekable.</p>

<p>When outputting to &#39;-&#39; (STDOUT) the <code>Stream</code> option is automatically enabled.</p>

<p>The default is 0.</p>

</dd>
<dt id="Zip64-=&gt;-0|1"><a id="Zip64"></a><a id="Zip64---0-1"></a><code>Zip64 =&gt; 0|1</code></dt>
<dd>

<p>ZIP64 is an extension to the Zip archive structure that allows</p>

<ul>

<li><p>Zip archives larger than 4Gig.</p>

</li>
<li><p>Zip archives with more that 64K members.</p>

</li>
</ul>

<p>The module will automatically enable ZIP64 mode as needed when creating zip archive.</p>

<p>You can force creation of a Zip64 zip archive by enabling this option.</p>

<p>If you intend to manipulate the Zip64 zip archives created with this module using an external zip/unzip program/library, make sure that it supports Zip64.</p>

<p>The default is 0.</p>

</dd>
</dl>

<h2 id="Other-Options"><a id="Other"></a>Other Options</h2>

<dl>

<dt id="AutoFlush-=&gt;-0|1"><a id="AutoFlush"></a><a id="AutoFlush---0-1"></a><code>AutoFlush =&gt; 0|1</code></dt>
<dd>

<p>When true this option enabled flushing of the underlying filehandle after each write/print operation.</p>

<p>If SimpleZip is writing to a buffer, this option is ignored.</p>

</dd>
<dt id="Comment-=&gt;-$comment"><a id="Comment"></a><a id="Comment----comment"></a><code>Comment =&gt; $comment</code></dt>
<dd>

<p>This option allows the creation of a comment that is associated with the member added to the zip archive with the <code>add</code> and <code>addString</code> methods.</p>

<p>This option is not valid in the constructor.</p>

<p>By default, no comment field is written to the zip archive.</p>

</dd>
<dt id="Encode-=&gt;-&quot;encoding&quot;"><a id="Encode"></a><a id="Encode----encoding"></a><code>Encode =&gt; &quot;encoding&quot;</code></dt>
<dd>

<p>The <code>Encode</code> option allows you to set the character encoding of the data before it is compressed and written to the zip file. The option is only valid with the <code>add</code> or <code>addString</code> methods. It will be ignored if you use it with the <code>add</code> option.</p>

<p>Under the hood this option relies on the <code>Encode</code> module to carry do the hard work. In particular it uses the <code>Encode::find_encoding</code> to check that the encoding you have request exists.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my.zip&quot;
        or die &quot;$SimpleZipError\n&quot; ;

    $z-&gt;addString(&quot;payload data&quot;, Encode =&gt; &quot;utf8&quot;) ;</code></pre>

</dd>
<dt id="Method-=&gt;-$method"><a id="Method"></a><a id="Method----method"></a><code>Method =&gt; $method</code></dt>
<dd>

<p>Controls which compression method is used. At present the compression methods supported are: Store (no compression at all), Deflate, Bzip2, Zstd, Xz and Lzma.</p>

<p>The symbols, ZIP_CM_STORE, ZIP_CM_DEFLATE, ZIP_CM_BZIP2, ZIP_CM_ZSTD, ZIP_CM_XZ and ZIP_CM_LZMA are used to select the compression method.</p>

<p>These constants are not imported by default by this module.</p>

<pre><code>    use Archive::Zip::SimpleZip qw(:zip_method);
    use Archive::Zip::SimpleZip qw(:constants);
    use Archive::Zip::SimpleZip qw(:all);</code></pre>

<p>Note that to create Bzip2 content, the module <code>IO::Compress::Bzip2</code> must be installed. A fatal error will be thrown if you attempt to create Bzip2 content when <code>IO::Compress::Bzip2</code> is not available.</p>

<p>Note that to create Lzma content, the module <code>IO::Compress::Lzma</code> must be installed. A fatal error will be thrown if you attempt to create Lzma content when <code>IO::Compress::Lzma</code> is not available.</p>

<p>Note that to create Xz content, the module <code>IO::Compress::Xz</code> must be installed. A fatal error will be thrown if you attempt to create Xz content when <code>IO::Compress::Xz</code> is not available.</p>

<p>Note that to create Zstd content, the module <code>IO::Compress::Zstd</code> must be installed. A fatal error will be thrown if you attempt to create Zstd content when <code>IO::Compress::Zstd</code> is not available.</p>

<p>The default method is ZIP_CM_DEFLATE for files and ZIP_CM_STORE for directories and symbolic links.</p>

</dd>
<dt id="StoreLink-=&gt;-1|0"><a id="StoreLink"></a><a id="StoreLink---1-0"></a><code>StoreLink =&gt; 1|0</code></dt>
<dd>

<p>Controls what <code>Archive::Zip::SimpleZip</code> does with a symbolic link (assuming your operating system supports .</p>

<p>When true, it stores the link itself. When false, it stores the contents of the file the link refers to.</p>

<p>If your platform does not support symbolic links this option is ignored.</p>

<p>Default is 0.</p>

</dd>
<dt id="TextFlag-=&gt;-0|1"><a id="TextFlag"></a><a id="TextFlag---0-1"></a><code>TextFlag =&gt; 0|1</code></dt>
<dd>

<p>This parameter controls the setting of a flag in the zip central header. It is used to signal that the data stored in the zip archive is probably text.</p>

<p>The default is 0.</p>

</dd>
<dt id="ZipComment-=&gt;-$comment"><a id="ZipComment"></a><a id="ZipComment----comment"></a><code>ZipComment =&gt; $comment</code></dt>
<dd>

<p>This option allows the creation of a comment field for the entire zip archive.</p>

<p>This option is only valid in the constructor.</p>

<p>By default, no comment field is written to the zip archive.</p>

</dd>
</dl>

<h2 id="Deflate-Compression-Options"><a id="Deflate"></a>Deflate Compression Options</h2>

<p>These option are only valid if the <code>Method</code> is ZIP_CM_DEFLATE. They are ignored otherwise.</p>

<dl>

<dt id="Level-=&gt;-value"><a id="Level"></a><a id="Level---value"></a><code>Level =&gt; value</code></dt>
<dd>

<p>Defines the compression level used by zlib. The value should either be a number between 0 and 9 (0 means no compression and 9 is maximum compression), or one of the symbolic constants defined below.</p>

<pre><code>   Z_NO_COMPRESSION
   Z_BEST_SPEED
   Z_BEST_COMPRESSION
   Z_DEFAULT_COMPRESSION</code></pre>

<p>The default is Z_DEFAULT_COMPRESSION.</p>

</dd>
<dt id="Strategy-=&gt;-value"><a id="Strategy"></a><a id="Strategy---value"></a><code>Strategy =&gt; value</code></dt>
<dd>

<p>Defines the strategy used to tune the compression. Use one of the symbolic constants defined below.</p>

<pre><code>   Z_FILTERED
   Z_HUFFMAN_ONLY
   Z_RLE
   Z_FIXED
   Z_DEFAULT_STRATEGY</code></pre>

<p>The default is Z_DEFAULT_STRATEGY.</p>

</dd>
</dl>

<h2 id="Bzip2-Compression-Options"><a id="Bzip2"></a>Bzip2 Compression Options</h2>

<p>These option are only valid if the <code>Method</code> is ZIP_CM_BZIP2. They are ignored otherwise.</p>

<dl>

<dt id="BlockSize100K-=&gt;-number"><a id="BlockSize100K"></a><a id="BlockSize100K---number"></a><code>BlockSize100K =&gt; number</code></dt>
<dd>

<p>Specify the number of 100K blocks bzip2 uses during compression.</p>

<p>Valid values are from 1 to 9, where 9 is best compression.</p>

<p>The default is 1.</p>

</dd>
<dt id="WorkFactor-=&gt;-number"><a id="WorkFactor"></a><a id="WorkFactor---number"></a><code>WorkFactor =&gt; number</code></dt>
<dd>

<p>Specifies how much effort bzip2 should take before resorting to a slower fallback compression algorithm.</p>

<p>Valid values range from 0 to 250, where 0 means use the default value 30.</p>

<p>The default is 0.</p>

</dd>
</dl>

<h2 id="Lzma-&amp;-XZ-Compression-Options"><a id="Lzma"></a><a id="Lzma---XZ-Compression-Options"></a>Lzma &amp; XZ Compression Options</h2>

<p>These option are only valid if the <code>Method</code> is ZIP_CM_LZMA or ZIP_CM_LZMA. They are ignored otherwise.</p>

<dl>

<dt id="Preset-=&gt;-number"><a id="Preset"></a><a id="Preset---number"></a><code>Preset =&gt; number</code></dt>
<dd>

<p>Used to choose the LZMA compression preset.</p>

<p>Valid values are 0-9 and <code>LZMA_PRESET_DEFAULT</code>.</p>

<p>0 is the fastest compression with the lowest memory usage and the lowest compression.</p>

<p>9 is the slowest compession with the highest memory usage but with the best compression.</p>

<p>Defaults to <code>LZMA_PRESET_DEFAULT</code> (6).</p>

</dd>
<dt id="Extreme-=&gt;-0|1"><a id="Extreme"></a><a id="Extreme---0-1"></a><code>Extreme =&gt; 0|1</code></dt>
<dd>

<p>Makes LZMA compression a lot slower, but a small compression gain.</p>

<p>Defaults to 0.</p>

</dd>
</dl>

<h2 id="Zstd-Compression-Options"><a id="Zstd"></a>Zstd Compression Options</h2>

<p>These option are only valid if the <code>Method</code> is ZIP_CM_ZSTD. They are ignored otherwise.</p>

<dl>

<dt id="Level-=&gt;"><a id="Level1"></a><code>Level =&gt;</code></dt>
<dd>

<p>Defines the compression level used.</p>

<p>Default value is 3.</p>

</dd>
</dl>

<h1 id="Summary-of-Default-Behaviour"><a id="Summary"></a>Summary of Default Behaviour</h1>

<p>By default <code>Archive::Zip::SimpleZip</code> will do the following</p>

<ul>

<li><p>Use Deflate Compression for all standard files.</p>

</li>
<li><p>Create a non-streamed Zip archive.</p>

</li>
<li><p>Follow Symbolic Links</p>

</li>
<li><p>Canonicalise the filename before adding it to the zip archive</p>

</li>
<li><p>Only use create a ZIP64 Zip archive if any of the input files is greater than 4 Gig or there are more than 64K members in the zip archive.</p>

</li>
<li><p>Fill out the following zip extended attributes</p>

<pre><code>    &quot;UT&quot; Extended Timestamp
    &quot;ux&quot; ExtraExtra Type 3 (if running Unix)</code></pre>

</li>
</ul>

<p>You can change the behaviour of most of the features mentioned above.</p>

<h1 id="Examples">Examples</h1>

<h2 id="A-Simple-example"><a id="A"></a>A Simple example</h2>

<p>Add all the &quot;C&quot; files in the current directory to the zip archive &quot;my.zip&quot;.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my.zip&quot;
        or die &quot;$SimpleZipError\n&quot; ;

    for ( &lt;*.c&gt; )
    {
        $z-&gt;add($_)
            or die &quot;Cannot add &#39;$_&#39; to zip file: $SimpleZipError\n&quot; ;
    }

    $z-&gt;close();</code></pre>

<h2 id="Creating-an-in-memory-Zip-archive"><a id="Creating"></a>Creating an in-memory Zip archive</h2>

<p>All you need to do if you want the zip archive to be created in-memory is to pass a string reference to the constructor. The example below will store the zip archive in the variable <code>$zipData</code>.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $zipData ;
    my $z = new Archive::Zip::SimpleZip \$zipData
        or die &quot;$SimpleZipError\n&quot; ;

    $z-&gt;add(&quot;part1.txt&quot;);
    $z-&gt;close();</code></pre>

<p>Below is a slight refinement of the in-memory story. As well as writing the zip archive into memory, this example uses c&lt;addString&gt; to create the member &quot;part2.txt&quot; without having to read anything from the filesystem.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $zipData ;
    my $z = new Archive::Zip::SimpleZip \$zipData
        or die &quot;$SimpleZipError\n&quot; ;

    $z-&gt;addString(&quot;some text&quot;, Name =&gt; &quot;part2.txt&quot;);
    $z-&gt;close();</code></pre>

<h2 id="Rename-whilst-adding"><a id="Rename"></a>Rename whilst adding</h2>

<p>The example below shows how the <code>FilterName</code> option can be use to remove the path from the filename before it gets written to the zip archive, &quot;my.zip&quot;.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $z = new Archive::Zip::SimpleZip &quot;my.zip&quot;
        or die &quot;$SimpleZipError\n&quot; ;

    for ( &lt;/some/path/*.c&gt; )
    {
        $z-&gt;add($_, FilterName =&gt; sub { s[^.*/][] }  )
            or die &quot;Cannot add &#39;$_&#39; to zip file: $SimpleZipError\n&quot; ;
    }

    $z-&gt;close();</code></pre>

<h2 id="Adding-a-directory-tree-to-a-Zip-archive"><a id="Adding"></a>Adding a directory tree to a Zip archive</h2>

<p>If you need to add all (or part) of a directory tree into a Zip archive, you can use the standard Perl module <code>File::Find</code> in conjunction with this module.</p>

<p>The code snippet below assumes you want the non-directories files in the directory tree <code>myDir</code> added to the zip archive <code>found.zip</code>. It also assume you don&#39;t want the files added to include any part of the <code>myDir</code> relative path.</p>

<pre><code>    use strict;
    use warnings;

    use Archive::Zip::SimpleZip;
    use File::Find;

    my $filename = &quot;found.zip&quot;;
    my $dir = &quot;myDir&quot;;
    my $z = new Archive::Zip::SimpleZip $filename
        or die &quot;Cannot open file $filename\n&quot;;

    find( sub { $z-&gt;add($_) if ! -d $_ }, $dir);

    $z-&gt;close();</code></pre>

<p>If you <i>do</i> want to include relative paths, pass the <code>$File::Find::name</code> variable with the <code>Name</code> option, as shown below.</p>

<pre><code>    find( sub
          {
              $z-&gt;add($_, Name =&gt; $File::Find::name)
                   if ! -d $_
          },
          $dir);</code></pre>

<h2 id="Using-addFileHandle"><a id="Using"></a>Using addFileHandle</h2>

<p>Say you have a number of old-style &quot;.Z&quot; compressed files that you want to uncompress and put into a zip file. The script below, Z2zip.pl, will do just that</p>

<pre><code>    use strict;
    use warnings;

    use Archive::Zip::SimpleZip qw($SimpleZipError);

    die &quot;Usage: Z2zip.pl zipfilename file1.Z file2.Z...\n&quot;
        unless @ARGV &gt;= 2 ;

    my $zipFile = shift ;
    my $zip = new Archive::Zip::SimpleZip $zipFile
                or die &quot;Cannot create zip file &#39;$zipFile&#39;: $SimpleZipError&quot;;

    for my $Zfile (@ARGV)
    {
        my $cleanName = $Zfile ;
        $cleanName =~ s/\.Z$//;

        print &quot;Adding $cleanName\n&quot; ;

        open my $z, &quot;uncompress -c $Zfile |&quot; ;

        $zip-&gt;addFileHandle($z, Name =&gt; $cleanName)
            or die &quot;Cannot addFileHandle &#39;$cleanName&#39;: $SimpleZipError\n&quot; ;
    }</code></pre>

<h2 id="Another-filehandle-example-Working-with-Net::FTP"><a id="Another"></a>Another filehandle example - Working with Net::FTP</h2>

<p>Say you want to read all the json files from ftp://ftp.perl.org/pub/CPAN/ using Net::FTP and write them directly to a zip archive without having to store them in the filesystem first.</p>

<p>Here are a couple of ways to do that. The first uses the <code>openMember</code> method in conjunction with the <code>Net::FTP::get</code> method as shown below.</p>

<pre><code>    use strict;
    use warnings;

    use Net::FTP;
    use Archive::Zip::SimpleZip qw($SimpleZipError);

    my $zipFile = &quot;json.zip&quot;;
    my $host = &#39;ftp.perl.org&#39;;
    my $path = &quot;/pub/CPAN&quot;;

    my $zip = new Archive::Zip::SimpleZip $zipFile
            or die &quot;Cannot create zip file &#39;$zipFile&#39;: $SimpleZipError&quot;;

    my $ftp = new Net::FTP($host)
        or die &quot;Cannot connect to $host: $@&quot;;

    $ftp-&gt;login(&quot;anonymous&quot;,&#39;-anonymous@&#39;)
        or die &quot;Cannot login &quot;, $ftp-&gt;message;

    $ftp-&gt;cwd($path)
        or die &quot;Cannot change working directory &quot;, $ftp-&gt;message;

    my @files = $ftp-&gt;ls()
        or die &quot;Cannot ls&quot;, $ftp-&gt;message;

    for my $file ( grep { /json$/ } @files)
    {
        print &quot; Adding $file\n&quot; ;

        my $zipMember = $zip-&gt;openMember(Name =&gt; $file)
            or die &quot;Cannot openMember file &#39;$file&#39;: $SimpleZipError\n&quot; ;

        $ftp-&gt;get($file, $zipMember)
            or die &quot;Cannot get&quot;, $ftp-&gt;message;
    }</code></pre>

<p>Alternatively, Net::FTP allows a read filehandle to be opened for a file to transferred using the <code>retr</code> method. This filehandle can be <i>dropped</i> into a zip archive using <code>addFileHandle</code>. The code below is a rewrite of the for loop in the previous version that shows how this is done.</p>

<pre><code>    for my $file ( grep { /json$/ } @files)
    {
        print &quot; Adding $file\n&quot; ;

        my $fh = $ftp-&gt;retr($file)
            or die &quot;Cannot get&quot;, $ftp-&gt;message;

        $zip-&gt;addFileHandle($fh, Name =&gt; $file)
            or die &quot;Cannot addFileHandle file &#39;$file&#39;: $SimpleZipError\n&quot; ;

        $fh-&gt;close()
            or die &quot;Cannot close&quot;, $ftp-&gt;message;
    }</code></pre>

<p>One point to be aware of with the <code>Net::FTP::retr</code>. Not all FTP servers support it. See <a href="https://metacpan.org/pod/Net::FTP">Net::FTP</a> for details of how to find out what features an FTP server implements.</p>

<h2 id="Creating-a-Zip-file-from-STDIN"><a id="Creating1"></a>Creating a Zip file from STDIN</h2>

<p>The script below, zipstdin. shows how to create a zip file using data read from STDIN.</p>

<pre><code>    use strict;
    use warnings;

    use Archive::Zip::SimpleZip qw($SimpleZipError);

    my $zipFile = &quot;stdin.zip&quot;;

    my $zip = new Archive::Zip::SimpleZip $zipFile
            or die &quot;Cannot create zip file &#39;$zipFile&#39;: $SimpleZipError&quot;;
    $zip-&gt;adFilehandle(STDIN, Name =&gt; &quot;data.txt&quot;) ;</code></pre>

<p>or this, to do the whole thing from the commandline</p>

<pre><code>    echo abc | perl -MArchive::Zip::SimpleZip -e &#39;Archive::Zip::SimpleZip-&gt;new(&quot;stdin.zip&quot;)-&gt;addFileHandle(STDIN, Name =&gt; &quot;data.txt&quot;)&#39;</code></pre>

<h1 id="Importing">Importing</h1>

<p>A number of symbolic constants are required by some methods in <code>Archive::Zip::SimpleZip</code>. None are imported by default.</p>

<dl>

<dt id=":all"><a id="all"></a>:all</dt>
<dd>

<p>Imports <code>zip</code>, <code>$SimpleZipError</code> and all symbolic constants that can be used by <code>IArchive::Zip::SimpleZip</code>. Same as doing this</p>

<pre><code>    use Archive::Zip::SimpleZip qw(zip $SimpleZipError :constants) ;</code></pre>

</dd>
<dt id=":constants"><a id="constants"></a>:constants</dt>
<dd>

<p>Import all symbolic constants. Same as doing this</p>

<pre><code>    use Archive::Zip::SimpleZip qw(:flush :level :strategy :zip_method) ;</code></pre>

</dd>
<dt id=":flush"><a id="flush"></a>:flush</dt>
<dd>

<p>These symbolic constants are used by the <code>flush</code> method.</p>

<pre><code>    Z_NO_FLUSH
    Z_PARTIAL_FLUSH
    Z_SYNC_FLUSH
    Z_FULL_FLUSH
    Z_FINISH
    Z_BLOCK</code></pre>

</dd>
<dt id=":level"><a id="level"></a>:level</dt>
<dd>

<p>These symbolic constants are used by the <code>Level</code> option in the constructor.</p>

<pre><code>    Z_NO_COMPRESSION
    Z_BEST_SPEED
    Z_BEST_COMPRESSION
    Z_DEFAULT_COMPRESSION</code></pre>

</dd>
<dt id=":strategy"><a id="strategy"></a>:strategy</dt>
<dd>

<p>These symbolic constants are used by the <code>Strategy</code> option in the constructor.</p>

<pre><code>    Z_FILTERED
    Z_HUFFMAN_ONLY
    Z_RLE
    Z_FIXED
    Z_DEFAULT_STRATEGY</code></pre>

</dd>
<dt id=":zip_method"><a id="zip_method"></a>:zip_method</dt>
<dd>

<p>These symbolic constants are used by the <code>Method</code> option in the constructor.</p>

<pre><code>    ZIP_CM_STORE
    ZIP_CM_DEFLATE
    ZIP_CM_BZIP2</code></pre>

</dd>
</dl>

<h1 id="FAQ">FAQ</h1>

<h2 id="Can-SimpleZip-update-an-existing-Zip-file?"><a id="Can"></a><a id="Can-SimpleZip-update-an-existing-Zip-file"></a>Can SimpleZip update an existing Zip file?</h2>

<p>No. You can only create a zip file from scratch.</p>

<h2 id="Can-I-write-a-Zip-Archive-to-STDOUT?"><a id="Can1"></a><a id="Can-I-write-a-Zip-Archive-to-STDOUT"></a>Can I write a Zip Archive to STDOUT?</h2>

<p>Yes. Writing zip files to filehandles that are not seekable (so that includes both STDOUT and sockets) is supported by this module. You just have to set the <code>Stream</code> option when you call the constructor.</p>

<pre><code>    use Archive::Zip::SimpleZip qw($SimpleZipError) ;

    my $zipData ;
    my $z = new Archive::Zip::SimpleZip &#39;-&#39;,
                        Stream =&gt; 1
        or die &quot;$SimpleZipError\n&quot; ;

    $z-&gt;add(&quot;file1.txt&quot;);
    $z-&gt;close();</code></pre>

<p>See <a href="./Archive::Zip::SimpleZip.html#What-is-a-Streamed-Zip-file?">&quot;What is a Streamed Zip file?&quot;</a> for a discussion on the <code>Stream</code> option.</p>

<h2 id="Can-I-write-a-Zip-Archive-directly-to-a-socket?"><a id="Can2"></a><a id="Can-I-write-a-Zip-Archive-directly-to-a-socket"></a>Can I write a Zip Archive directly to a socket?</h2>

<p>See previous question.</p>

<h2 id="What-is-a-Streamed-Zip-file?"><a id="What"></a><a id="What-is-a-Streamed-Zip-file"></a>What is a Streamed Zip file?</h2>

<p>Streaming mode allows you to write a zip file in situation where you cannot seek backwards/forwards. The classic examples are when you are working with sockets or need to write the zip file to STDOUT.</p>

<p>By default <code>Archive::Zip::SimpleZip</code> does <i>not</i> use streaming mode when writing to a zip file (you need to set the <code>Stream</code> option to 1 to enable it).</p>

<p>If you plan to create a streamed Zip file be aware that it will be slightly larger than the non-streamed equivalent. If the files you archive are 32-bit the overhead will be an extra 16 bytes per file written to the zip archive. For 64-bit it is 24 bytes per file.</p>

<h1 id="SUPPORT">SUPPORT</h1>

<p>General feedback/questions/bug reports should be sent to <a href="https://github.com/pmqs/Archive-Zip-SimpleZip/issues">https://github.com/pmqs/Archive-Zip-SimpleZip/issues</a> (preferred) or <a href="https://rt.cpan.org/Public/Dist/Display.html?Name=Archive-Zip-SimpleZip">https://rt.cpan.org/Public/Dist/Display.html?Name=Archive-Zip-SimpleZip</a>.</p>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p><a href="https://metacpan.org/pod/Archive::Zip::SimpleUnzip">Archive::Zip::SimpleUnzip</a>, <a href="https://metacpan.org/pod/IO::Compress::Zip">IO::Compress::Zip</a>, <a href="./Archive::Zip.html">Archive::Zip</a>, <a href="https://metacpan.org/pod/IO::Uncompress::UnZip">IO::Uncompress::UnZip</a></p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>This module was written by Paul Marquess, <i>pmqs@cpan.org</i>.</p>

<h1 id="MODIFICATION-HISTORY"><a id="MODIFICATION"></a>MODIFICATION HISTORY</h1>

<p>See the Changes file.</p>

<h1 id="COPYRIGHT-AND-LICENSE"><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>Copyright (c) 2012-2022 Paul Marquess. All rights reserved.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Archive::Zip::SimpleZip, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Archive::Zip::SimpleZip</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Archive::Zip::SimpleZip</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Archive::Zip::SimpleZip.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
